package com.broada.apm.indicator.api.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.broada.apm.dao.DomainDao;
import com.broada.apm.indicator.api.AppDomainService;
import com.broada.apm.model.Domain;

public class AppDomainServiceImpl implements AppDomainService {
	
	@Autowired
	private DomainDao domainDao;

	@Override
	public Domain queryDomainById(String domainId) {
		return domainDao.queryDomainById(domainId);
	}

	@Override
	public void saveDomain(Domain domain) {
		List<Domain> doamins = domainDao.queryDomainsByCondition(domain);
		if (doamins == null || doamins.isEmpty())
			domainDao.addDomain(domain);
	}

}
